
<div style="line-height: 30px;float: right;margin-top: 20px;min-width: 300px" class="pages">
    <ul>
        <li style="width: 20%;float: left;text-align: center;cursor: pointer;list-style-type: none;"><a onclick="page_up()">上一页</a></li>
        <li style="width: 25%;float: left;text-align: center;font-size: 14px;list-style-type: none;">
            <if condition="$count eq 0 ">0
            <else/>
            <input type="text" onchange="gopage({$page_all})" id="gopage" value="{$page}" style="width: 40%;border: none;background: none;text-align: right;line-height: 30px;font-size: 15px;padding-bottom: 5px;padding-right: 5px">
            </if>
            /{$page_all}
        </li>
        <li style="width: 20%;float: left;text-align: center;cursor: pointer;list-style-type: none;"><a onclick="page_down({$page_all})">下一页</a></li>
        <li style="width: 35%;float: left;text-align: center;font-size: 14px;list-style-type: none;">共{$count}条记录</li>
    </ul>
</div>
<script type="text/javascript">
    var page_url = document.getElementById("page_url").value;
    function gopage(page_all){
        var url = window.location.href;
        var a = getQueryString('a');
        url = changeURLPar(url, 'a', page_url);
        var page = document.getElementById("gopage").value;
            if(page <= page_all){
                url = changeURLPar(url, 'page', page);
                window.location.href = url
            }else{
                url = changeURLPar(url, 'page', page_all);
                window.location.href = url
            }
    }
    //下一页
    function page_down(page_all){
        var url = window.location.href;
        var page = getQueryString('page');
        var a = getQueryString('a');
        url = changeURLPar(url, 'a', page_url);
        if(page_all > 1 && page == null){
            window.location.href = url+"&page=2"
        }else{
            if(page < page_all){
                page = Number(page) + Number(1);
                url = changeURLPar(url, 'page', page);
                window.location.href = url
            }else{
                window.location.href = url
            }

        }
    }
    //上一页
    function page_up(){
        var url = window.location.href;
        var page = getQueryString('page');
        var a = getQueryString('a');
        url = changeURLPar(url, 'a', page_url);
        if(page == 1 || page == null){
            window.location.href = url
        }else{
            page = Number(page) - Number(1);
            url = changeURLPar(url, 'page', page);
            window.location.href = url
        }
    }
    //改url参数  destinv = url   par = 要改的参数  par_value = 新参数值
    //url = changeURLPar(url, 'page', page);
    function changeURLPar(destiny, par, par_value)
    {
        var pattern = par+'=([^&]*)';
        var replaceText = par+'='+par_value;
        if (destiny.match(pattern))
        {
            var tmp = '/\\'+par+'=[^&]*/';
            tmp = destiny.replace(eval(tmp), replaceText);
            return (tmp);
        }
        else
        {
            if (destiny.match('[\?]'))
            {
                return destiny+'&'+ replaceText;
            }
            else
            {
                return destiny+'?'+replaceText;
            }
        }
        return destiny+'\n'+par+'\n'+par_value;
    }

    //获取参数值   name=参数名
    //var page = getQueryString('page');
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }

</script>